package com.hs;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author: hs
 * @Description:
 * @Date: Create in 11:12 2019/8/28
 */
public class AtomicIntegerTest implements Runnable {

    public int count=0;
    AtomicInteger atomicInteger = new AtomicInteger(0);

    @Override
    public void run() {
        count++;
        atomicInteger.incrementAndGet();
    }


    public static void main(String[] args) throws InterruptedException {
        AtomicIntegerTest run = new AtomicIntegerTest();
        for (int i = 0; i < 100000; i++) {
            new Thread(run).start();
        }
        System.out.println("ss");
        Thread.sleep(20000);
        System.out.println("c" + run.count);
        System.out.println("s" + run.atomicInteger.get());
    }
}
